package com.bestcem.xm.user.dao.mapper;

import com.bestcem.xm.user.entity.mysql.RolePermission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 角色权限mapper
 *
 * @author wangyunyun <yunyun.wang@idiaoyan.com>
 * @version v1.0
 * @date 2022/3/17 15:01
 */
@Mapper
public interface RolePermissionMapper {

    /**
     * 根据主键删除
     *
     * @param rolePermissionId
     * @return int
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 16:13
     */
    int deleteByPrimaryKey(String rolePermissionId);

    /**
     * 插入
     *
     * @param rolePermission
     * @return int
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 16:13
     */
    int insertSelective(RolePermission rolePermission);

    /**
     * 查询
     *
     * @param rolePermissionId
     * @return RolePermission
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 16:13
     */
    RolePermission selectByPrimaryKey(String rolePermissionId);

    /**
     * 根据主键更新
     *
     * @param rolePermission
     * @return int
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 16:13
     */
    int updateByPrimaryKeySelective(RolePermission rolePermission);

    /**
     * 根据角色id删除
     *
     * @param roleId
     * @return java.lang.Integer
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 16:13
     */
    Integer deleteRolePermissionByRoleId(String roleId);

    /**
     * 根据结构id和角色id查询
     *
     * @param orgId
     * @param roleId
     * @return int
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 16:13
     */
    RolePermission selectByOrgIdAndRoleId(String orgId, String roleId);

    /**
     * 通过角色id集合查询权限
     *
     * @param roleIds
     * @param orgId
     * @return List<RolePermission>
     * @author wangyunyun <yunyun.wang@idiaoyan.com>
     * @version v1.0
     * @date 2022/3/18 11:30
     */
    List<RolePermission> listByRoleIds(@Param("roleIds") List<String> roleIds, @Param("orgId") String orgId);

    /**
     * 通过id集合批量更新角色权限
     *
     * @param roleIds
     * @param param
     * @return Integer
     * @author wangyunyun <yunyun.wang@idiaoyan.com>
     * @version v1.0
     * @date 2022/3/21 11:36
     */
    Integer updateByIds(@Param("roleIds") List<String> roleIds, @Param("param") RolePermission param);
}